<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>商品页</title>
    <style>
	</style>
    <link rel="stylesheet" type="text/css" th:href="@{/static/layui-v2.6.13/layui/css/layui.css}"/>
    <script type="text/javascript" th:src="@{/static/js/jquery-1.9.1.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/layui-v2.6.13/layui/layui.js}"></script>
</head>
<body>
    <div class="layui-row" style="width: 100%;background-color: white;">
        <div class="layui-col-md3" style="padding: 50px 10px 50px 50px;">
            <img th:src="@{/static/img/}+${good.url}" width="250px" height="250px"/>
        </div>
        <div class="layui-col-md9" style="padding-top: 50px;">
            <table width="25%">
                <tr>
                    <td>
                        <p class="layui-font-20 layui-font-black" >[[${good.name}]]</p>
                    </td>
                </tr>
                <tr>
                    <td>库存数量：[[${good.amount}]]</td>
                </tr>
                <tr>
                    <td>
                        <div style="color: orangered;font-size: 20px;">￥[[${good.price}]]</div>
                    </td>
                </tr>
            </table>
            <div style="margin-top: 40px;">
                <div class="layui-inline layui-font-20" style="width: 15%;">
                    <button class="layui-btn layui-btn-fluid layui-bg-orange" th:onclick="buy([[${good.id}]])">
                        <i class="layui-icon layui-icon-cart-simple" style="color: white;">
                            加入购物车
                        </i>
                    </button>
                </div>
                <div class="layui-inline layui-font-20" style="width: 15%;" >
                    <button class="layui-btn layui-btn-fluid layui-bg-red" th:onclick="buy([[${good.id}]])">
                        立即购买
                    </button>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    layui.use('layer',function(){
        var layer = layui.layer;
    });
    function buy(id){
        layer.open({
            type:2,
            title: "详情",
            area:['650px','500px'],
            content:'tobuy?id='+id,
            end:function(){
                location.reload();
            }
        });
    }

</script>
</html>